package cn.qyd.leecode;

import com.google.common.collect.Lists;

import java.util.*;
import java.util.stream.IntStream;

/**
 * @author 邱运铎
 * 实验各种基础语法的demo 类，里面保持空即可，每次实验可将main方法中的代码快删除
 * @date 2024-04-07 21:07
 */
public class LearningDemo {
    public static void main(String[] args) {
        String s = "abc";
        int[][] shifts = {{0,1,0},{1,2,1},{0,2,1}};
        char[] origin = s.toCharArray();
        int[] diff = new int[origin.length + 1];

        for (int i = 0; i < shifts.length; i++) {
            int[] o = shifts[i];
            diff[o[0]] += o[2] * 2 - 1;
            diff[o[1] + 1] -= o[2] * 2 -1;
        }
        System.out.println(Arrays.toString(diff));
        int shift = 0;
        for (int i = 0; i < origin.length; i++) {
            shift = (shift + diff[i]) % 26 + 26;
            origin[i] = (char)((origin[i] - 'a' + shift) % 26 + 'a');
        }

        System.out.println(String.valueOf(origin));
        Integer[] integers = IntStream.range(0, 10).boxed().toArray(Integer[]::new);
        int[] ints = IntStream.range(0, 10).toArray();
        Arrays.sort(integers, (a , b) -> b-a);;
        System.out.println(Arrays.toString(integers));
        System.out.println(integers[0].getClass());


    }

//
//    public void inputHandle() {
//        Scanner scanner = new Scanner(System.in);
//        while (scanner.hasNextInt()) {
//            int n = scanner.nextInt();
//            if (n == -1) {
//                break;
//            }
//            int[] arr = new int[n];
//            for (int i = 0; i < n; i++) {
//                arr[i] = scanner.nextInt();
//            }
//            System.out.println(Arrays.toString(arr));
//        }
//    }
}
